home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / content / nsIFormSubmission.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  5KB  |  138 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsIFormSubmission_h___
  38. #define nsIFormSubmission_h___
  39.  
  40. #include "nsISupports.h"
  41. class nsAString;
  42. class nsACString;
  43. class nsIURI;
  44. class nsIInputStream;
  45. class nsGenericHTMLElement;
  46. class nsPresContext;
  47. class nsIContent;
  48. class nsIFormControl;
  49. class nsIDOMHTMLElement;
  50. class nsIDocShell;
  51. class nsIRequest;
  52.  
  53. #define NS_IFORMSUBMISSION_IID   \
  54. { 0x7ee38e3a, 0x1dd2, 0x11b2, \
  55.   {0x89, 0x6f, 0xab, 0x28, 0x03, 0x96, 0x25, 0xa9} }
  56.  
  57. /**
  58.  * Interface for form submissions; encompasses the function to call to submit as
  59.  * well as the form submission name/value pairs
  60.  */
  61. class nsIFormSubmission : public nsISupports
  62. {
  63. public:
  64.  
  65.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFORMSUBMISSION_IID)
  66.  
  67.   /**
  68.    * Find out whether or not this form submission accepts files
  69.    *
  70.    * @param aAcceptsFiles the boolean output
  71.    */
  72.   virtual PRBool AcceptsFiles() const = 0;
  73.  
  74.   /**
  75.    * Call to perform the submission
  76.    *
  77.    * @param aActionURL the URL to submit to (may be modified with GET contents)
  78.    * @param aTarget the target window
  79.    * @param aSource the element responsible for the submission (for web shell)
  80.    * @param aPresContext the presentation context
  81.    * @param aDocShell (out param) the DocShell in which the submission was
  82.    *        loaded
  83.    * @param aRequest (out param) the Request for the submission
  84.    */
  85.   virtual nsresult SubmitTo(nsIURI* aActionURL, const nsAString& aTarget,
  86.                             nsIContent* aSource, nsPresContext* aPresContext,
  87.                             nsIDocShell** aDocShell,
  88.                             nsIRequest** aRequest) = 0;
  89.  
  90.   /**
  91.    * Submit a name/value pair
  92.    *
  93.    * @param aSource the control sending the parameter
  94.    * @param aName the name of the parameter
  95.    * @param aValue the value of the parameter
  96.    */
  97.   virtual nsresult AddNameValuePair(nsIDOMHTMLElement* aSource,
  98.                                     const nsAString& aName,
  99.                                     const nsAString& aValue) = 0;
  100.  
  101.   /**
  102.    * Submit a name/file pair
  103.    *
  104.    * @param aSource the control sending the parameter
  105.    * @param aName the name of the parameter
  106.    * @param aFilename the name of the file (pass null to provide no name)
  107.    * @param aStream the stream containing the file data to be sent
  108.    * @param aContentType the content-type of the file data being sent
  109.    * @param aMoreFilesToCome true if another name/file pair with the same name
  110.    *        will be sent soon
  111.    */
  112.   virtual nsresult AddNameFilePair(nsIDOMHTMLElement* aSource,
  113.                                const nsAString& aName,
  114.                                const nsAString& aFilename,
  115.                                nsIInputStream* aStream,
  116.                                const nsACString& aContentType,
  117.                                PRBool aMoreFilesToCome) = 0;
  118.  
  119. };
  120.  
  121. //
  122. // Factory methods
  123. // 
  124.  
  125. /**
  126.  * Get a submission object based on attributes in the form (ENCTYPE and METHOD)
  127.  *
  128.  * @param aForm the form to get a submission object based on
  129.  * @param aPresContext the presentation context
  130.  * @param aFormSubmission the form submission object (out param)
  131.  */
  132. nsresult GetSubmissionFromForm(nsGenericHTMLElement* aForm,
  133.                                nsPresContext* aPresContext,
  134.                                nsIFormSubmission** aFormSubmission);
  135.  
  136.  
  137. #endif /* nsIFormSubmission_h___ */
  138.